//1、嵌入flex/iframe
(function(){
	__GsEcJsonp.jsonpcallback_2(
'<div style="width:100%;height:100%;border: 1px solid #CCC;"><div style="padding:15px;">'
+'<h4>问答QA</h4>Q:aaa<br/>A:bbb<br/>'
+'<input id="flex_qa_input_" class="input-medium search-query" type="text" value="qa submit 20130222" size="50" >'
+' <input class="btn" type="button" value="提问" onclick="_submitQa()" >'
+'</div></div>'
);

//  flex/iframe内部
window._submitQa=function(){
	var content = document.getElementById("flex_qa_input_").value;
	GsEc.room('').command("submitQa", content);
}
function appendMsg(data){
	var input1 = document.getElementById("flex_qa_input_");
	var theParent = input1.parentNode;
	var elem = document.createElement("span");
	elem.innerHTML = "Q:"+data+"<br/>";
	theParent.insertBefore(elem, input1);
}

//2、绑定服务端事件，用来通知flex/iframe QA
	var room = GsEc.room('');
	room.bind("qamsg", function(data){
		//call flex/iframe
		appendMsg(data);
	});
})();
